﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using Machine.Specifications;
using Moq;
using RxHeat.Tracing;

namespace RxHeat.Tests.Tracing
{
    public class TraceOutput
    {
        protected static readonly Guid _testInstance = Guid.NewGuid();
        protected static readonly List<string> _output = new List<string>();
        protected Cleanup cleanUp = () => _output.Clear();
    }

    public class EstablishDefaultTracer : TraceOutput
    {
        private Establish _ = () =>
            {
                Debug.WriteLine("when_tracing_a_stream._testInstance:" + _testInstance);

                var mock = new Mock<IRxHeatTraceListner>();
                mock.Setup(i => i.Trace(Moq.It.IsAny<TraceDetails>()))
                    .Callback<TraceDetails>(x => _output.Add("TRACE: " + x));
                TraceManager.AssignDefaultTraceListener(mock.Object);
            };
    }
}